package com.example.ck.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.ck.dao.CooperateDao;
import com.example.ck.entity.Cooperate;
import com.example.ck.service.CooperateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * (Cooperate)表服务实现类
 *
 * @author makejava
 * @since 2024-05-10 11:53:05
 */
@Service
public class CooperateServiceImpl implements CooperateService {
    @Autowired
    private CooperateDao cooperateDao;

    /**
     * 获取所有的合作信息
     *
     * @return
     */
    @Override
    public List<Cooperate> getAllCooperate() {
        return cooperateDao.selectList(null);
    }

    /**
     * 添加合作伙伴
     *
     * @param cooperate
     * @return
     */
    @Override
    public boolean addCooperate(Cooperate cooperate) {
        return cooperateDao.insert(cooperate) > 0;
    }

    /**
     * 根据id移除合作伙伴
     *
     * @return
     */
    @Override
    public boolean removeCooperate(Integer hz_id) {
        QueryWrapper qw = new QueryWrapper<>();
        qw.eq("hz_id", hz_id);
        int i = cooperateDao.delete(qw);
        return i > 0;
    }
}
